<!--
 * @Description: 
 * @Author: zyj
 * @Date: 2022-06-11 14:18:09
 * @LastEditors: zyj
 * @LastEditTime: 2022-06-11 16:56:29
-->
<template>
  <div>
    <k-form ref="loginForm" :model="form" :rules="rules">
      <k-form-item label="账号" prop="name">
        <k-input type="text" v-model="form.name"></k-input>
      </k-form-item>
      <k-form-item label="密码" prop="password">
        <k-input type="password" v-model="form.password"></k-input>
      </k-form-item>
    </k-form>
    <el-button type="primary" @click="loginIn()">登录</el-button>
  </div>
</template>

<script>
import KForm from './Form.vue'
import KFormItem from './FormItem.vue'
import KInput from './Input.vue'
export default {
  name: 'LoginForm',
  data() {
    return {
      form: {
        name: '',
        password: ''
      },
      rules: {
        name: [{ required: true, message: '请输入账号' }],
        password: [
          { required: true, message: '请输入密码' },
          { max: 10, min: 6, message: '密码长度为6~10位' }
        ]
      }
    }
  },
  components: {
    KForm,
    KFormItem,
    KInput
  },
  methods: {
    loginIn() {
      this.$refs.loginForm.validate((res) => {
        console.log(res)
      })
    }
  }
}
</script>
<style lang="" scoped>
</style>